<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta content="telephone=no" name="format-detection" />
    <!-- 留作将来统一添加 -->
    <TEMPLATE>${TEMPLATE}</TEMPLATE>
    <title>模板html</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css">
    <link rel="stylesheet" type="text/css" href="../../css/index.css">
    <link rel="stylesheet" type="text/css" href="../../css/data-flex.min.css">
    <style type="text/css">
        body {
            background:rgba(90,194,255,1);
        }

        .container {
            margin: 15px;
            padding: 0 15px;
            height: 50px;
            background:rgba(255,255,255,1);
            box-shadow:0px 4px 10px 0px rgba(0,135,214,0.37);
            border-radius:10px;
        }

        .input {
            font-size:15px;
            font-weight:400;
            color:rgba(25,25,25,1);
        }

        .input::placeholder {
            font-size:15px;
            font-weight:400;
            color:rgba(191,191,191,1);
        }

        .btn {
            width: 210px;
            height: 46px;
            background: url("../../image/ui/btn.png");
            background-size: 100% 100%;
            margin: 45px auto 0 auto;
            text-align: center;
            font-size:18px;
            font-weight:600;
            color:rgba(124,69,0,1);
            line-height: 42px;
            box-shadow: 0px 5px 7px 0px rgba(11, 126, 193, 0.53);
            border-radius: 22px;
        }
    </style>
</head>
<body>
    <div class="vueApp" v-cloak id="login" style="padding-bottom: 20px">
        <div class="container" data-flex="cross:center">
            <input class="input" data-flex-box="1" spellcheck="false"
                        type="password" v-model="password" minlength="6" maxlength="16"
                        data-type="_password" data-verify="true" data-null="true" data-regular="true" name="新密码"
                        placeholder="请输入新密码">
        </div>
        <div class="container" data-flex="cross:center">
            <input class="input" data-flex-box="1" spellcheck="false"
                        type="password" v-model="password2" minlength="6" maxlength="16"
                        data-type="_password" data-verify="true" data-null="true" data-regular="true" name="确认密码"
                        placeholder="请再次输入新密码">
        </div>
        <div class="btn" @click="handleSubmite()">提交</div>
    </div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/service/service-tool.js"></script>
<script type="text/javascript" src="../../script/service/service-app.js"></script>
<script type="text/javascript" src="../../script/service/service-user.js"></script>
<script type="text/javascript" src="../../script/service/service-logic.js"></script>
<script type="text/javascript" src="../../script/service/service-verify.js"></script>
<script type="text/javascript" src="../../script/jquery.min.js"></script>
<script type="text/javascript" src="../../script/vue.min.js"></script>
<script type="text/javascript">
    // html 的引号一律为双引号(""),js 为单引号('')
    var USER, $S, vm;
    apiready = function(){
        $S = SERVICE();
        USER = USER();
        console.log(JSON.stringify(api.pageParam) + '=====pageParam');
        fnInit();
    };

    // 初始化
    function fnInit() {
        vm = new Vue({
            el: '.vueApp',
            data: {
                password: '',
                password2: ''
            }
        });
    }

    // 提交
    function handleSubmite() {
        if (fnVerify("login")) {
            if(vm.password !== vm.password2) {
                fnToast('两次输入密码不一致，请重新输入');
            }else {
                var params = {
                    password: vm.password,
                    newPassword: vm.password2
                };
                var url = 'apiTbAppUser/updatePassword';
                var callback = function(data) {
                    fnToast('修改成功');
                    setTimeout(function(){
                        api.closeWin();
                    }, 1000)
                };
                POST(url, params, callback);
            }
        }
    }
</script>
</html>